﻿@model Nutrapp.DBAL.Ingredient

@{
    ViewBag.Title = "Create";
}
<div class="row">
    @using (Html.BeginForm("Create", "Ingredients", FormMethod.Post, new { @class = "span4" }))
    {
        <fieldset>
            <legend>Create Ingredient</legend>
            <div class="control-group">
            </div>
            @{
        if (@Session["carboError"] != null)
        {
                <p style="color: red">
                    @Session["carboError"].ToString()
                </p>


        }
        if (@Session["existIngrError"] != null)
        {
                <p style="color: red">
                    @Session["existIngrError"].ToString()
                </p>
            Session["existIngrError"] = "";
        }
        if (@Session["nameError"] != null)
        {
                <p style="color: red">
                    @Session["nameError"].ToString()
                </p>
            Session["nameError"] = "";

        }
            }
            <div>
                <table>
                    <tr style="height: 50px">
                        <td>
                            <label>Ingredient Name</label>
                        </td>
                        <td>
                            @Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
                        </td>

                    </tr>
                    <tr style="height: 50px">
                        <td>
                            <label>Ingredient Ctegory</label>
                        </td>
                        <td>@Html.DropDownListFor(model => model.Category, (SelectList)ViewBag.ID, "Select category", new { @class = "form-control" })</td>
                    </tr>
                    <tr style="height: 50px">
                        <td>
                            <label>Carbohydrate</label>
                        </td>
                        <td>
                            @Html.TextBoxFor(m => m.Carbohydrate, new { @class = "form-control" })
                        </td>

                    </tr>
                    <tr style="height: 50px">
                        <td>
                            <label>Protein</label>
                        </td>
                        <td>
                            @Html.TextBoxFor(m => m.Protein, new { @class = "form-control" })
                        </td>

                    </tr>
                    <tr style="height: 50px">
                        <td>
                            <label>Calories</label>
                        </td>
                        <td>
                            @Html.TextBoxFor(m => m.Calories, new { @class = "form-control" })
                        </td>

                    </tr>
                    <tr style="height: 50px">
                        <td>
                            <label>Fat</label>
                        </td>
                        <td>
                            @Html.TextBoxFor(m => m.Fat, new { @class = "form-control" })
                        </td>

                    </tr>
                    <tr style="height: 50px">
                        <td>
                            <label>Grams in peice </label>
                        </td>
                        <td>
                            @Html.TextBoxFor(m => m.PeiceToGram, new { @class = "form-control" })
                        </td>

                    </tr>
                </table>

            </div>         

            <div style="margin-top: 20px" class="form-actions">
                <button type="submit" class="btn btn-primary">Save Changes</button>
            </div>

              <div style="margin-top:10px">
                @Html.ActionLink("Back to List", "Index", "Ingredients")
            </div>
        </fieldset>
    }
</div>

